home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 501 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: colossus.holonet.net!russell
  2. From: russell@news.mdli.com (Russell Blackadar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: beginner question - typecasting
  5. Date: 4 Jan 1996 20:40:33 GMT
  6. Organization: HoloNet National Internet Access System: 510-704-1058/modem
  7. Message-ID: <4che01$kjm@colossus.holonet.net>
  8. References: <4cei1r$s02@sun.cis.smu.edu> <30EBCED7.774@sto.fdata.se>
  9. NNTP-Posting-Host: jubal.mdli.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Niklas Mellin (niklas.mellin@sto.fdata.se) wrote:
  13. : Damon Bowman wrote:
  14. : > 
  15. : > When you are typecasting, is there any difference between:
  16. : > 
  17. : > a = int(x)
  18. : > and
  19. : > a = (int) x
  20.  
  21. : [...]
  22.  
  23. [...]
  24.  
  25. : The 2nd form is an inheritance from plain C, and doesn't work
  26. : when x is of class type...
  27.  
  28. Ahem, this is wrong.  Both forms are valid in C++, and both
  29. invoke the class's operator int.  There is absolutely no
  30. functional difference between the two forms.  It would be
  31. nice to have just one syntax to convert types, but since C
  32. supports both, C++ must also.  Take a look at the ARM, please.
  33. --
  34. Russell Blackadar,   russell@mdli.com
  35.